Let’s look at NYC Restaruant Inspection dataset

Load, clean and filter the dataset

data("rest_inspec")
inspec_data = 
  rest_inspec %>%
  janitor::clean_names() %>%
  select(boro, zipcode, street, cuisine_description, grade, score) %>%
  drop_na(score)

scatterplot

inspec_data %>%
  filter(grade %in% c("A","B","C")) %>%
  mutate(text_label = str_c("Cuisine Type:", cuisine_description )) %>%
  plot_ly(
    x = ~zipcode, y = ~score, 
    color = ~grade, alpha = 0.5,
    type = "scatter", mode = "markers",
    text = ~text_label
  )